import request from '@/utils/request'

/**
 * 获取聊天历史
 */
export function getChatHistory(params) {
  return request({
    url: '/chat/history',
    method: 'get',
    params
  })
}

/**
 * 获取未读消息数
 */
export function getUnreadCount(userId) {
  return request({
    url: '/chat/unread-count',
    method: 'get',
    params: { userId }
  })
}

/**
 * 标记消息为已读
 */
export function markAsRead(userId, senderId) {
  return request({
    url: '/chat/mark-read',
    method: 'post',
    params: { userId, senderId }
  })
}

/**
 * 撤回消息
 */
export function recallMessage(messageId, userId) {
  return request({
    url: '/chat/recall',
    method: 'post',
    params: { messageId, userId }
  })
}

